20. Color Masking

Nd113 C7 19 L Color Masking

Color Masking

We know about how color images are represented numerically, and next, I want to show you how color can be used in image analysis and transformation. We’ll start by learning how to use information about the colors in an image to isolate a particular area in an image. This is easiest to understand in an example.

We'll be selecting an area of interest using a color threshold. Color thresholds are used in a number of applications including extensively in computer graphics and video; a common use is with a green screen.

A green screen is used to layer two images or video streams based on identifying and replacing a large green area.

Car on a green screen background.

Car on a green screen background.

So, how does all this work?

Well, the first step is to isolate the green background, and then replace that green area with an image of your choosing. Next, let's see how to do this programmatically with the image shown above!